/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: COFFEEWEN
 * Date: 2022-08-22
 * Time: 18:48
 */
public class Test {
    public static int mySqrt(int x) {
        // 记录最接近x平方根的值
        long endKey = 0;
        for (long i = 0; i <= x; i++) {
            long tmp = i * i;
            if (tmp > x){
                break;
            }
            endKey = i;
        }
        return (int)endKey;
    }

    public static int singleNumber(int[] nums) {
        //int[] hash = new int[nums.length];
        for (int i = 0;i<nums.length;i++){
            int flag = 1;
            for (int j = 0;j<nums.length;j++){
                if (i != j){
                    if (nums[i] != nums[j]){
                        flag = 1;
                    }else if (nums[i] == nums[j]){
                        flag = 0;
                        break;
                    }
                }
                if (flag == 1){
                    return nums[i];
                }
            }
        }

        return 0;
    }
    public static void main(String[] args) {
        int[] a = {2,2,1};
        int n = singleNumber(a);
        System.out.println(111);
    }

}
